<?php
/**
 *	作者：耿鸿飞
 *	日期：2011年11月20日
 *	作用：测试程序
 **/

define("TOKENKEY","abc");
//define("APIURL","http://127.0.0.1/API/");
define("APIURL","http://127.0.0.1/my-project-langage-student/html/");
function getAPI($cmd,$data = array(),$sid = '',$transit = 'json',$lang = 'zh'){
	$ch = curl_init(APIURL.$cmd);
	if($ch){
		$set = array(
			CURLOPT_RETURNTRANSFER => true,
			CURLOPT_HEADER => false,
			CURLOPT_POST => true,
			CURLOPT_TIMEOUT => 30,
			CURLOPT_REFERER => "http://www.baidu.com",
			CURLOPT_HTTPHEADER => array("tokenkey: xxx","transition: json","langage: zh","sessionid: xx"),
			CURLOPT_POSTFIELDS => "",
		);
		curl_setopt_array($ch,$set);
		$str = curl_exec($ch);
		curl_close($ch);
		return $str;
	}
	return false;
}
var_dump(getAPI(""));